import axios from 'axios';
import { instance, plainAxios,instanceFlask }  from "../axios";
// api/seed.js
// // 获取种子列表（只传category）
// export const getSeedList = (category) => {
//   return instance.get('/torrents/list/',{params: {
//       category: category || ''  }});  
// };
export const getSeedList = () => {
  return instance.get('/torrents/list');  
};
// export const getSeedList = () => {
//   return instance.get('/torrents/list');  
// };
// 根据名字搜索种子
export const searchSeedByName = (name,type) => {
  return instance.get('/torrents/search', { params: {
      name: name,
      type: type
    } });  // 例如 /api/seeds/search?name=xxx
};

// params示例：
// {
//   category: '体育',
//   firsttype: '篮球',
//   secondtype: '2024',
//   thirdtype: 'NBA',
//   fourthtype: '1080P',
//   name: '湖人'
// }

// 根据ID获取单个种子详情接口
export const getSeedById = (id) => {
  return instance.get(`/torrents/view/${id}`);
};
export const getSeedType = (id) => {
  return instance.get(`/torrents/view/${id}`);
};
export const downloadFile = (id) => {
  return plainAxios.get(`/torrents/${id}/download`);
};
export const postComment = (data) => {
  return instance.post(`/seed/comment/post`,data);
};
export const unlikeComment = (commentId,userId) => {
  return instance.post(`/seed/comment/unlike`,{commentId,userId});
};
export const likeComment = (commentId,userId) => {
  return instance.post(`/seed/comment/like`,{commentId,userId});
};
export const getSeedComments = (seedId,userId) => {
  return instance.get(`/seed/getcomments/${seedId}/${userId}`);
};
